//
//  TraderTableViewCell.m
//  代理端
//
//  Created by mac on 16/3/7.
//  Copyright © 2016年 sliver. All rights reserved.
//

#import "TraderTableViewCell.h"
#import "TraderModel.h"
@interface  TraderTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconimage;
@property (weak, nonatomic) IBOutlet UILabel *moneyLable;
@property (weak, nonatomic) IBOutlet UILabel *typeLable;
@property (weak, nonatomic) IBOutlet UILabel *timeLable;
@property (weak, nonatomic) IBOutlet UILabel *countLable;

@end


@implementation TraderTableViewCell

- (void)awakeFromNib {

    self.countLable.hidden = YES;
    
    self.iconimage.layer.masksToBounds = YES;
    
    self.iconimage.layer.cornerRadius = 3;
    [AutoLayoutUtil autoLayoutWith:self.contentView.subviews];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)gaveMeModel:(TraderModel *)model
{
    
    self.typeLable.text = model.file1;
    self.moneyLable.text = model.money;
    NSString *str = [model.tmstamp substringToIndex:10];
    
    self.timeLable.text = str;
    
    if (![model.file1 isEqualToString:@"充值"]&&![model.file1 isEqualToString:@"返利"]) {
        NSString *str = [NSString stringWithFormat:@"%@x%@",model.file2,model.file3];
        self.countLable.text = str;
        self.countLable.hidden = NO;
    }else
    {
        self.countLable.hidden = YES;
    }
    
    if ([model.file1 isEqualToString:@"充值"]) {
        self.iconimage.image=[UIImage imageNamed:@"chongzhi.png"];
    }else if ([model.file1 isEqualToString:@"返利"])
    {
        self.iconimage.image=[UIImage imageNamed:@"fanli.png"];

    }else
    {
        NSString *str = [NSString stringWithFormat:@"%@%@",BASE_URL,model.imgurl];
        NSURL *url = [NSURL URLWithString:str];
        [self.iconimage setImageWithURL:url placeholderImage:[UIImage imageNamed:@"kucunzhanwei.png"]];
        
        
    }
    
}
@end
